﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;
using System.Xml;
//using System.Windows.Forms;
using System.Reflection;

namespace GameStudio.Common//.Serilization
{
    public class ProjectFactory
    {
        
        public Project project;
        public ProjectFactory()
        {
            project = new Project();
        }
        public ProjectFactory(string Location, string Name)
        {
            project = new Project();
 
            project.Setting.Version = "Game Studio 0.1";
            project.ProjectName = Name;
            string File = System.IO.Path.Combine(Location, Name);
            project.Location = File;
        }
        public void AddFile(FileItem CurrentFile)
        {
            project.items.Add(CurrentFile);
        }
        public static List<Type> GetTypes()
        {

            List<Type> types = new List<Type>();

            Assembly asm = typeof(Project).Assembly;

            Type _Item = typeof(Items);

            //Query our types. We could also load any other assemblies and
            //query them for any types that inherit from Items

            foreach (Type currType in asm.GetTypes())
            {
                if (!currType.IsAbstract
                    && !currType.IsInterface
                    && _Item.IsAssignableFrom(currType))

                    types.Add(currType);
            }

            return types;
        }
      
    }
}
